package com.blue.ui;


import com.blue.dao.AccountDao;
import com.blue.service.AccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @BelongsProject: mytest
 * @BelongsPackage: com.blue.ui
 * @Author: wsh
 * @CreateTime: 2020-04-08 22:42
 */
public class TestUi {
    /**
     * 获取spring的IOC容器,并根据id获取对象
     *
     * @param args
     */
    public static void main(String[] args) {
        //1获取IOC核心容器
        ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
        //获取AccountService对象
        AccountService accountService = (AccountService) ac.getBean("accountService");
        //获取AccountDao对象
        AccountDao accountDao = (AccountDao) ac.getBean("accountDao");
        System.out.println(accountService);
        System.out.println(accountDao);
    }
}
